import { createApp } from 'vue'
// 先导入Quasar
import { Quasar, Notify, Dialog } from 'quasar'
// 使用预编译的CSS而非Sass
import 'quasar/dist/quasar.css'
// 导入图标
import '@quasar/extras/material-icons/material-icons.css'
// 然后是应用的样式
import './style.css'
// 最后导入应用组件
import App from './App.vue'
import { createPinia } from 'pinia'
import { useUserStore } from './stores/user'
import router from './router'

const app = createApp(App)

// 注册Quasar
app.use(Quasar, {
  plugins: {
    Notify,
    Dialog
  },
  config: {
    brand: {
      primary: '#1976D2',
      secondary: '#26A69A',
      accent: '#9C27B0',
      positive: '#21BA45',
      negative: '#C10015',
      info: '#31CCEC',
      warning: '#F2C037'
    },
    notify: {
      position: 'top',
      timeout: 2500
    }
  }
})

const pinia = createPinia()
app.use(pinia)

const userStore = useUserStore()

// 检查用户是否登录
if (userStore.currentUser) {
  // 用户已登录
} else {
  // 用户未登录
}

app.use(router)

app.mount('#app')